package pl.edu.pw.perg.compinfodb.command;

import org.springframework.richclient.command.support.AbstractActionCommandExecutor;

import pl.edu.pw.perg.compinfodb.datamodel.HistoryTableModel;
import pl.edu.pw.perg.compinfodb.datamodel.IPhysicalElementSelectionListener;
import pl.edu.pw.perg.compinfodb.entities.PhysicalElement;

public class AddEventCommandExecutor extends AbstractActionCommandExecutor implements IPhysicalElementSelectionListener {

	private HistoryTableModel htm;
	
	public AddEventCommandExecutor(HistoryTableModel htm){
		this.htm = htm;
	}
	
	@Override
	public void execute() {
		htm.createEvent();
	}

	public void selectionChanged(PhysicalElement ce) {
		if(ce != null)
			setEnabled(true);
		else
			setEnabled(false);
		
		
	}
	
	
}
